﻿using DynConDevCorp.OpenArch.SmartData.Interfaces;

namespace DynConDevCorp.OpenArch.SmartData.Interfaces
{
    /// <summary>
    ///  Type Safe Smart Collection with a Primary Key value.
    /// </summary>
    /// <typeparam name="TKey">The type of the Key.</typeparam>
    /// <typeparam name="TItem">The type Smart object contained in the collection.</typeparam>
    public interface ISmartKeyedCollection<TKey, TItem> : ISmartCollection<TItem>
        where TItem : ISmartBase
    {
        #region Public Instance Properties

        /// <summary>
        /// Gets the <see cref="ISmartBase"/> instance with the specified key.
        /// </summary>
        /// <value></value>
        TItem this[TKey key] { get; }

        #endregion

        #region Public Instance Methods

        /// <summary>
        /// Adds the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="item">The item.</param>
        void Add(TKey key, TItem item);
        /// <summary>
        /// Removes the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        bool Remove(TKey key);
        /// <summary>
        /// Determines whether [contains] [the specified key].
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns>
        /// 	<c>true</c> if [contains] [the specified key]; otherwise, <c>false</c>.
        /// </returns>
        bool Contains(TKey key);

        #endregion
    }
}